package com.example.homework.homework02;

/**
 * 矩形类
 */
public class Rectangle {
    private int length; // 长
    private int width; // 宽

    public Rectangle() {

    }

    public Rectangle(int length, int width) {
        this.length = length;
        this.width = width;
    }

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    void area() {
        System.out.println("矩形的面积是：" + length * width);
    }

    void perimeter() {
        System.out.println("矩形的周长是：" + (length + width) * 2);
    }
}
